import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import md5 from 'js-md5'
import 'lib-flexible/flexible'

import { Confirm, ConfirmPlugin, ToastPlugin, AlertPlugin} from 'vux'

Vue.use(ToastPlugin)


Vue.use(ConfirmPlugin)
Vue.use(AlertPlugin)

Vue.component('confirm', Confirm)


const FastClick = require('fastclick')
FastClick.attach(document.body)


Vue.prototype.$md5 = md5

// Vue.prototype.$axios = axios http://haigou.com/api
// axios.defaults.baseURL = BASE_URL;
// let baseUrl = 'http://192.168.0.253/api/'; // 局域网
let baseUrl = 'http://haigou.com/api/'; // 本地、
// let baseUrl = 'http://api.hzshuyu.com/api/'; // 测试
// let baseUrl = 'http://api.higo.live/api/';

Vue.prototype.$axios =  axios.create({
    baseURL: baseUrl,
    crossDomain:true,
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
    }
});


router.beforeEach((to, from, next) => {
    /* 路由发生变化修改页面title */
    if (to.meta.title) {
        document.title = to.meta.title
    }
    next()
})



Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
